using Perfect.Marshal;
using System.Xml;

namespace editor
{
namespace cfg.blueprint
{
[System.Serializable]
public  class BoolArray : ArrayVar
 {

    public System.Collections.Generic.List<bool> defaultValue  = new System.Collections.Generic.List<bool>();
     


    public const int TYPE_ID = 740182198;

    public override int GetTypeId() {
        return TYPE_ID;
    }


    public override void MarshalCompatible(Perfect.Marshal.Octets os) {
        os.WriteSize(1);
        os.WriteSize(Tag.LIST | (1 << Tag.TAG_SHIFT));  { var _oldOs = os; os = new Perfect.Marshal.Octets(); cfg.Extensions.marshal_compatible_list_bool(defaultValue,os);  _oldOs.WriteOctets(os); os = _oldOs;}  
         
    }

    public override void UnmarshalCompatible(Perfect.Marshal.Octets os) {
        for (int _var_num_ = os.ReadSize(); _var_num_-- > 0; ) {
            int _id_ = os.ReadSize();
            switch (_id_)
            {
            case (Tag.LIST | (1 << Tag.TAG_SHIFT)):  { var _oldOs = os; os = os.ReadOctets(); defaultValue = cfg.Extensions.unmarshal_compatible_list_bool(os); os = _oldOs; break; }   
             
            default: Tag.SkipUnknownField(_id_, os); break;
            }
         }
    }
    public override void MarshalXml(XmlWriter ele)
    {
        ele.WriteAttributeString("type", "BoolArray");
        ele.WriteStartElement("defaultValue"); ele.WriteAttributeString("id", "1"); cfg.Extensions.xml_marshal_list_bool(defaultValue,ele); ele.WriteEndElement();
         
    }

    public override void UnmarshalXml(XmlElement ele)
    {
        foreach (XmlElement e in ele.GetChildren())
        {
            if (int.TryParse(ele.GetAttribute("id"), out var _id_))
            {
                switch (_id_)
                {
                case 1:  defaultValue = cfg.Extensions.xml_unmarshal_list_bool(ele); break; 
                 
                default: break;
                }
            }
            else
            {
                switch (e.Name)
                {
                case "default_value":  defaultValue = cfg.Extensions.xml_unmarshal_list_bool(ele); break; 
                 
                default: break;
                }
            }
        }
    }
}
}
}
